package club.justwill.single.assembler;

import club.justwill.single.bean.UserAdviceResp;
import club.justwill.single.persistence.document.UserAdvice;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by luoyu on 2/23/16.
 */
@Component
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public class UserAdviceAssemble {
    public UserAdviceResp assembleUserAdvice(UserAdvice userAdvice) {
        return new UserAdviceResp(userAdvice);
    }
    public List<UserAdviceResp> assebmleUserAdviceList(List<UserAdvice> userAdviceList) {
        List<UserAdviceResp> userAdviceRespList = new ArrayList<UserAdviceResp>();
        for (UserAdvice userAdvice : userAdviceList) {
            userAdviceRespList.add(new UserAdviceResp(userAdvice));
        }
        return userAdviceRespList;
    }
}
